<?php

require ("dbcon.php");
$bbseid=isset($_GET['e_id']) ? $_GET['e_id']:0;
if(empty($_POST))
{
$sql="select * from tb_emp where e_id={$bbseid}";
$result=$db->query($sql);
$emplist=$result->fetch_assoc();
require("edit_html.php");
}
else
    {
$ename=$_POST['e_name'];
$edept=$_POST['e_dept'];
$eimg=$_POST['e_img'];
$date_of_birth=$_POST['date_of_birth'];
$date_of_entry=$_POST['date_of_entry'];
$sql="update tb_emp set e_name='$e_name',edept='$e_dept',eimg='$e_img',date_of_birth='$date_of_birth',date_of_entry='$date_of_entry' where e_id='{$e_id}'";
$rs=$db->query($sql);
if($rs)
{
    echo"<script language='javascript' type='text/javascript'>";
    echo"alert('修改成功');";
    echo "window.location.href='index.php':";
    echo"</script>"; 
    exit;
}
else 
{
    echo"修改失败！";
    exit;
}
}
?>